<template>
	<view :style="themeColor">
		<view class="page">
			<view class="flex benben-position-layout flex flex-wrap align-center myAttention_flex_0"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex flex-wrap align-center justify-between flex-sub myAttention_fd0_0'>
					<view class='flex flex-wrap align-center myAttention_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back"
						data-url="1">
						<text class='fu-iconfont2  myAttention_fd0_0_c0_c0'>&#xE794;</text>
					</view>
					<view class='flex flex-wrap align-stretch justify-center'>
						<text class='myAttention_fd0_0_c1_c0'>预约记录</text>
					</view>
					<view class='flex flex-wrap align-center justify-end myAttention_fd0_0_c0'>
					</view>
				</view>
			</view>

			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			<!---flex布局flex布局开始-->
			<view style="width: 750rpx;padding-left: 2rpx;padding-bottom: 4rpx;">
				<u-tabs :list="jingang" :current='current' @change='changes' height="80" bar-width="26" bar-height="6"
					inactive-color="#707072" :is-scroll="true" name="subject_name" active-color="#333333"
					:bar-style='barTstyle'></u-tabs>
			</view>
			<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout">
				<block v-if="isshow">
					<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout homePage_flex_4">
						<view class='flex flex-wrap ' style="justify-content: space-between;">
							<view class='flex flex-direction flex-wrap  homePage_fd4_0_c0' v-for="(item,index) in homeList"
								:key="index">
								<!-- @tap.stop="handleJumpDiy" data-type="navigateTo"
								:data-url="`/pages/homePage/vipInfo/vipInfo?id=${item.aid}`" -->
								<!-- <image class='homePage_fd4_0_c0_c0' mode="aspectFill" :src='item.cover'></image> -->
								<view class='flex align-center service_bodyItemfd2_0_c3_c1_c0_c1'>
									<text class='service_bodyItemfd2_0_c3_c1_c0_c1_c1'
										v-if="current==0">团课名称:{{item.leagueClassName || '空'}}</text>
									<text class='service_bodyItemfd2_0_c3_c1_c0_c1_c1' v-if="current==1">私教课名称:{{item.cardName || '空'}}</text>
								</view>
								<view class='flex align-center service_bodyItemfd2_0_c3_c1_c0_c12' v-if="current==1">
									<text class='service_bodyItemfd2_0_c3_c1_c0_c2_c0'>私教教练:{{item.coachName || '空'}}</text>
								</view>
								<view class='flex align-center service_bodyItemfd2_0_c3_c1_c0_c11'>
									<view>
										<text class='service_bodyItemfd2_0_c3_c1_c0_c2_c0' v-if="current==0">预约日期:{{item.courseDate || '空'}}</text>
										<text class='service_bodyItemfd2_0_c3_c1_c0_c2_c0'
											v-if="current==1">预约日期:{{item.reservationDate || '空'}}</text>
									</view>


									<block v-if="current==0">
										<view class="goumai" style="margin-left: auto;" @tap="quxiao(item,0)">
											<text style="font-size: 32rpx;color: #ffffff;">取消预约</text>
										</view>
									</block>

									<block v-if="current==1">
										<view class="goumai" style="margin-left: auto;" @tap="quxiao(item,1)"
											v-if="item.reservationSituation==2">
											<text style="font-size: 32rpx;color: #ffffff;">取消预约</text>
										</view>
										<view class="goumai" style="margin-left: auto;" @tap="quxiao(item,1)"
											v-if="item.reservationSituation==3">
											<text style="font-size: 32rpx;color: #ffffff;">确定核销</text>
										</view>
										<view class="goumai" style="margin-left: auto;" v-if="item.reservationSituation==1">
											<text style="font-size: 32rpx;color: #ffffff;">已取消</text>
										</view>
										<view class="goumai" style="margin-left: auto;background:#bababa;"
											v-if="item.reservationSituation==0">
											<text style="font-size: 32rpx;color: #ffffff;">已完成</text>
										</view>
									</block>

								</view>
								<view class='flex flex-wrap align-center service_bodyItemfd2_0_c3_c1_c0_c2'>

									<view>
										<text class='service_bodyItemfd2_0_c3_c1_c0_c2_c0' v-if="current==0">
											上课时间:{{item.reservationStartTime || '空'}}-{{item.reservationEndTime || '空'}}
										</text>
										<text class='service_bodyItemfd2_0_c3_c1_c0_c2_c0' v-if="current==1">
											预约时间:{{item.teachStartTime || '空'}}-{{item.teachEndTime || '空'}}
										</text>
									</view>


									<!-- <view class="goumaib" style="margin-left: auto;" v-if="current==1">
										<text style="font-size: 32rpx;color: #000;">已失效</text>
									</view> -->

								</view>
							</view>
						</view>
					</view>

				</block>
				<block v-if="isshow==false">
					<view style="display: flex;justify-content: center;margin-top: 106rpx;width: 750rpx;">
						<image src='../../../static/images/order.png' mode="aspectFill" style="width:440rpx;height: 328rpx;">
						</image>
					</view>
				</block>
			</view>
			<benben-popup v-model="popupShow1656992350800" :mask="true" :mask-close-able="true" mode='center'>
				<view class="flex flex-direction flex-wrap align-center system_flex_2">
					<text class='system_fd2_0'>提示</text>
					<!-- <text class='system_fd2_1' v-if="type==0">当前服务仅对VIP开放</text> -->
					<text class='system_fd2_1'>确定取消预约吗?</text>
					<view class='flex align-center system_fd2_2'>
						<button class='system_fd2_2_c0' @tap.stop="popupShow1656992350800=false">取消</button>
						<button class='system_fd2_2_c1' @tap.stop="confirmFunc0()" v-if="current==0">确定</button>
						<button class='system_fd2_2_c1' @tap.stop="confirmFunc1()" v-if="current==1">确定</button>
					</view>
				</view>
			</benben-popup>
			<u-loadmore v-if="last_page > 1" class="loadmore" font-size="24" :status="status" :icon-type="iconType"
				:load-text="loadText" />
			<!---flex布局flex布局结束-->


		</view>
	</view>
</template>
<script>
	export default {
		components: {},


		data() {
			return {
				popupShow1656992350800: false,
				twoList: '',
				current: 0,
				jingang: [{
						id: 0,
						name: '团课预约'
					},
					{
						id: 1,
						name: '私教预约'
					}
				],
				isshow: '',
				homeList: [],
				aid: '',
				barTstyle: {
					backgroundColor: '#167deb',
					'border-radius': '2rpx'
				},
				selectedItem: 0,
				"page": 1,
				"is_pull": true,
				"last_page": 1,
				"status": 'loadmore',
				"iconType": 'flower',
				"loadText": {
					loadmore: '轻轻上拉',
					loading: '努力加载中',
					nomore: '我也是有底线的'
				},
				userId: '',
				tuankeitem: '',
				sijiaoitem: ''
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {},
		onLoad(options) {
			this.userId = uni.getStorageSync('userId')
			this.gethomeList()
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom() {
			// if (this.last_page == undefined) return
			// if (this.page >= this.last_page) return;
			// this.status = 'loading';
			// this.page++;
			// setTimeout(() => {
			// 	if (this.page >= this.last_page) this.status = 'nomore';
			// 	else this.status = 'loading';
			// 	this.is_pull = false;
			// 	this.getfollowList();
			// }, 500)
		},
		onPageScroll(e) {

		},
		methods: {
			changes(e) {
				console.log(e, 'tab栏索引')
				this.current = e
				if (this.current == 0) {
					this.gethomeList()
				} else {
					this.getsijiaoList()
				}
			},
			quxiao(item, type) {
				if (type == 0) {
					this.popupShow1656992350800 = true
					this.tuankeitem = item
				} else {
					this.popupShow1656992350800 = true
					this.sijiaoitem = item
				}
			},

			//查询团课预约记录
			async gethomeList() {
				uni.showLoading({
					title:'加载中'
				})
				// let requestUrl = `${}/${this.userId}`;
				let res = await this.$api.get(global.apiUrls.gymReservation, {
					memberId: this.userId
				});
				if (res.data.code != 200) {
					this.$message.info(res.data.msg);
					return
				}
				this.homeList = res.data.rows
				uni.hideLoading()
				if (this.homeList.length == 0) {
					this.isshow = false
				} else {
					this.isshow = true
				}
				console.log(this.homeList, '团课预约列表')
			},
			//取消团课预约记录
			async confirmFunc0() {
				let res = await this.$api.put(global.apiUrls.canceltuanke, {
					reservationId: this.tuankeitem.id,
					memberId: this.userId
				});
				if (res.data.code != 200) {
					this.$message.info(res.data.msg);
					return
				}
				this.gethomeList()
				this.$message.info('取消成功');
				this.popupShow1656992350800 = false
			},
			//查询私教预约记录
			async getsijiaoList() {
				uni.showLoading({
					title:'加载中'
				})
				// let requestUrl = `${}/${this.userId}`;
				let res = await this.$api.get(global.apiUrls.privateTeachingSchedule, {
					memberId: this.userId
				});
				if (res.data.code != 200) {
					this.$message.info(res.data.msg);
					return
				}
				this.homeList = res.data.rows
				uni.hideLoading()
				if (this.homeList.length == 0) {
					this.isshow = false
				} else {
					this.isshow = true
				}
				console.log(this.homeList, '私教预约列表')
			},
			//取消私教预约记录
			async confirmFunc1() {

				let requestUrl = `${global.apiUrls.deleteSijiao}/${this.sijiaoitem.id}`;
				let res = await this.$api.put(requestUrl);
				if (res.data.code != 200) {
					this.$message.info(res.data.msg);
					return
				}
				this.getsijiaoList()
				this.$message.info('取消成功');
				this.popupShow1656992350800 = false
			},
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: #f8f8fa;
		background-size: 100% auto;
	}

	.activeaaa {
		/* 单独选中项的样式 */
		font-size: 28rpx !important;
		background: #feede0 !important;
		color: #f48c40;
	}

	.footPrint_bodyItemfd4_0_c3_c0_c0_c0_c1_c0_c0_c0_c0_c0_c1 {
		color: #FFFFFF;
		font-size: 20rpx;
		font-weight: 400;
	}

	.footPrint_bodyItemfd4_0_c3_c0_c0_c0_c1_c0_c0_c0_c0_c0_c0 {
		width: 18rpx;
		height: 18rpx;
		margin-left: 8rpx;
		margin-right: 7rpx
	}

	.footPrint_bodyItemfd4_0_c3_c0_c0_c0_c1_c0_c0_c0_c0_c0_c01 {
		width: 124rpx;
		height: 36rpx;
	}

	.footPrint_bodyItemfd4_0_c3_c0_c0_c0_c1_c0_c0_c0_c0_c0 {
		background: linear-gradient(126deg, #FF4538 0%, #FF6530 100%);
		background-size: 100% auto;
		width: 124rpx;
		height: 36rpx;
		border-radius: 0rpx 16rpx 0rpx 10rpx;
		position: absolute;
		//bottom: 300rpx;
		left: 223rpx;
	}

	.footPrint_bodyItemfd4_0_c3_c0_c0_c0_c1_c0_c0_c0_c0_c01 {
		border-radius: 0rpx 16rpx 0rpx 16rpx;
		position: absolute;
		//bottom: 300rpx;
		left: 223rpx;
	}

	.myAttention_flex_0 {
		background: var(--benbenbgColor1);
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.myAttention_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 500;
		color: #333333;
		line-height: 88rpx;
	}

	.myAttention_fd0_0_c0_c0 {
		font-size: 36rpx;
		color: #333;
	}

	.myAttention_fd0_0_c0 {
		width: 120rpx;
	}

	.myAttention_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
	}

	.designPicture_flex_2 {
		margin: 24rpx 0rpx 33rpx 0rpx;
	}

	.homePage_flex_4 {
		background: #ffffff;
		background-size: 100% auto !important;
		padding: 0rpx 24rpx 0rpx 24rpx;
		width: 750rpx;
		// min-height: 600rpx;
		margin-top: 16rpx;
	}

	.homePage_fd4_0_c0 {
		background: #FFFFFF;
		position: relative;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		width: 702rpx;
		margin: 0rpx 0rpx 10rpx 0rpx;
		padding: 0rpx 0rpx 24rpx 0rpx;
		// box-shadow: 0rpx 3rpx 30rpx #E8E8E8;
		box-shadow: 0px 1px 15px #e8e8e8
	}

	.homePage_fd4_0_c0_c0 {
		width: 700rpx;
		height: 300rpx;
		border-radius: 16rpx 16rpx 0rpx 0rpx;
	}

	.service_bodyItemfd2_0_c3_c1_c0_c1 {
		margin: 18rpx 16rpx 0rpx 16rpx;
	}

	.service_bodyItemfd2_0_c3_c1_c0_c12 {
		margin: 18rpx 16rpx -6rpx 20rpx;
	}

	.service_bodyItemfd2_0_c3_c1_c0_c11 {
		margin: 12rpx 16rpx 12rpx 20rpx;
	}

	.service_bodyItemfd2_0_c3_c1_c0_c1_c1 {
		color: var(--benbenFontColor0);
		font-size: 28rpx;
		font-weight: 700;
		line-height: 40rpx;
		-webkit-line-clamp: 1;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		margin: 0rpx 0rpx 0rpx 2rpx;
		max-width: 500rpx;
	}

	.system_flex_2 {
		background: #fff;
		width: 540rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}

	.system_fd2_0 {
		font-size: 36rpx;
		font-weight: 800;
		line-height: 44rpx;
		color: #333333;
		margin: 40rpx 0rpx 40rpx 0rpx;
	}

	.system_fd2_1 {
		line-height: 44rpx;
		font-size: 32rpx;
		font-weight: 500;
		color: rgba(102, 102, 102, 1);
	}

	.system_fd2_2_c1 {
		border-top: 1px solid #eee;
		border-left: 1px solid #eee;
		background: transparent;
		line-height: 110rpx;
		border-radius: 0rpx 0rpx 16rpx 0rpx;
		font-size: 32rpx;
		color: #167deb;
		width: 268rpx;
	}

	.system_fd2_2_c0 {
		border-top: 1px solid #eee;
		background: #fff;
		line-height: 110rpx;
		border-radius: 0rpx 0rpx 0rpx 16rpx;
		font-size: 32rpx;
		color: rgba(153, 153, 153, 1);
		padding: 0rpx 103rpx 0rpx 103rpx;
	}

	.system_fd2_2 {
		margin: 37rpx 0rpx 0rpx 0rpx;
	}

	.service_bodyItemfd2_0_c3_c1_c0_c2 {
		margin: 0rpx 20rpx 0rpx 20rpx;
	}

	.service_bodyItemfd2_0_c3_c1_c0_c2_c0 {
		color: var(--benbenFontColor2);
		font-size: 24rpx;
		font-weight: 400;
		-webkit-line-clamp: 1;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		max-width: 360rpx;
	}

	.goumai {
		display: flex;
		justify-content: center;
		align-items: center;
		background: #167deb;
		border-radius: 28rpx;
		width: 160rpx;
		height: 58rpx;
		opacity: 0.8;
	}

	.goumaib {
		display: flex;
		justify-content: center;
		align-items: center;
		background: #eee;
		border-radius: 28rpx;
		width: 160rpx;
		height: 58rpx;
		opacity: 0.8;
	}

	.attc {
		width: 148rpx;
		height: 56rpx;
		background: #eee;
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 28rpx;
		margin-left: 24rpx;
		margin-top: 24rpx;
	}

	.myAttention_fd1_1_c0_c3 {
		border: 1px solid #F06600;
		background: rgba(240, 102, 0, 0.08);
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		width: 314rpx;
		line-height: 60rpx;
		font-size: 24rpx;
		color: rgba(240, 102, 0, 1);
		height: 56rpx;
		margin: 0rpx 0rpx 0rpx 16rpx;
		font-weight: 400;
	}

	.myAttention_fd1_1_c0_c2_c2 {
		color: rgba(153, 153, 153, 1);
		font-size: 24rpx;
		font-weight: 400;
	}

	.myAttention_fd1_1_c0_c2_c1 {
		margin: 0rpx 0rpx 0rpx auto;
		color: var(--benbenFontColor2);
		font-size: 24rpx;
		font-weight: 400;
	}

	.myAttention_fd1_1_c0_c2_c0 {
		color: var(--benbenFontColor2);
		font-size: 24rpx;
		font-weight: 400;
	}

	.myAttention_fd1_1_c0_c2 {
		margin: 0rpx 20rpx 16rpx 20rpx;
	}

	.myAttention_fd1_1_c0_c1_c1 {
		color: var(--benbenFontColor0);
		font-size: 28rpx;
		font-weight: 600;
		line-height: 40rpx;
		margin: 0rpx 0rpx 0rpx 16rpx;
		max-width: 249rpx;
	}

	.myAttention_fd1_1_c0_c1_c0 {
		width: 48rpx;
		height: 48rpx;
		border-radius: 10rpx;
	}

	.myAttention_fd1_1_c0_c1 {
		margin: 16rpx 16rpx 16rpx 16rpx;
	}

	.myAttention_fd1_1_c0_c0 {
		width: 346rpx;
		height: 300rpx;
		border-radius: 16rpx 16rpx 0rpx 0rpx;
	}

	.myAttention_fd1_1_c0 {
		background: #FFFFFF;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		width: 346rpx;
		margin: 0rpx 0rpx 10rpx 0rpx;
		padding: 0rpx 0rpx 24rpx 0rpx;
		box-shadow: 0rpx 3rpx 15rpx #E8E8E8;
		position: relative;
	}

	.myAttention_fd1_1 {
		//margin: 0rpx 0rpx 0rpx 24rpx;
		width: 750rpx;
		padding: 0rpx 24rpx;
		justify-content: space-between;
	}

	.myAttention_fd1_0_c1_c0 {
		color: #333;
		font-size: 24rpx;
		font-weight: 400;
	}

	.myAttention_fd1_0_c1 {
		background: rgba(248, 248, 250, 1);
		padding: 0rpx 32rpx 0rpx 32rpx;
		margin: 0rpx 4rpx 0rpx 4rpx;
		border-radius: 32rpx;
		background-size: 100% auto;
		line-height: 56rpx;
	}

	.myAttention_fd1_0_c0_c0 {
		color: rgba(240, 102, 0, 1);
		font-size: 24rpx;
		font-weight: 400;
	}

	.myAttention_fd1_0_c0 {
		background: rgba(254, 243, 235, 1);
		padding: 0rpx 32rpx 0rpx 32rpx;
		border-radius: 32rpx;
		background-size: 100% auto;
		line-height: 56rpx;
		margin: 0rpx 4rpx 0rpx 0rpx;
	}

	.myAttention_fd1_0 {
		touch-action: none;
		width: 885rpx;
		margin: 32rpx 0rpx 24rpx 24rpx;
	}
</style>